﻿<div [@routerTransition] (window:resize)="onResize($event)">
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title">
                    <span>需求更改审批</span>
                </h3>
            </div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <tabset class="tab-container tabbable-line">
                    <tab heading="需求更改" customClass="m-tabs__item">
                            <form class="horizontal-form" autocomplete="off">
                                <div class="m-form m-form--label-align-right">
                                    <div class="row align-items-center m--margin-bottom-10">
                                        <div class="col-xl-12">
                                            <div class="form-group m-form__group align-items-center">
                                                <div class="input-group">
                                                    <input [(ngModel)]="filterText" name="filterText" autoFocus class="form-control m-input" [placeholder]="l('SearchWithThreeDot')" type="text">
                                                    <span class="input-group-btn">
                                                        <button (click)="getRequirementPackages()" class="btn btn-primary" type="submit"><i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i></button>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        <div class="row margin-bottom-10">
                            <div class="col-xl-6">
                                <p>需求更改审批列表</p>
                            </div>
                            <div class="col-xl-6 text-right">
                            </div>
                        </div>
                        <div class="row">
                            <div class="primeng-datatable-container"
                                    [busyIf]="primengTableHelper.isLoading">
                                <p-table #dataTable
                                            (onLazyLoad)="getRequirementPackages($event)"
                                            [value]="primengTableHelper.records"
                                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}"
                                            [paginator]="false"
                                            [lazy]="true"
                                            [scrollable]="true"
                                            ScrollWidth="100%"
                                            [responsive]="primengTableHelper.isResponsive"
                                            [resizableColumns]="primengTableHelper.resizableColumns">
                                    <ng-template pTemplate="header">
                                        <tr>
                                            <th style="width: 130px" [hidden]="!isGrantedAny('Pages.StandardPartsManager.RequirementManagerAudit', 'Pages.StandardPartsManager.RequirementManagerAudit.Audit')">{{'Actions' | localize}}</th>
                                            <th style="width: 50px;text-align: center;">
                                                序号
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                型号数量改前
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                型号数量改后
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                工艺余量改前
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                工艺余量改后
                                            </th>
                                            <th style="width: 150px;text-align: center;">
                                                更改原因
                                            </th>
                                            <th style="width: 80px;text-align: center;">
                                                状态
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                创建人
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                创建时间
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                车间
                                            </th>
                                            <th style="width: 80px;text-align: center;">
                                                型号
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                发次
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                部段
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                编码
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                名称
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                标准
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                规格
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                材料
                                            </th>
                                            <th style="width: 100px;text-align: center;">
                                                需求时间
                                            </th>
                                        </tr>
                                    </ng-template>
                                    <ng-template pTemplate="body" let-record="$implicit" let-rowIndex="rowIndex">
                                        <tr>
                                            <td style="width: 130px"
                                                [hidden]="!isGrantedAny('Pages.StandardPartsManager.RequirementManagerAudit', 'Pages.StandardPartsManager.RequirementManagerAudit.Audit')">
                                                <div class="btn-group dropdown" dropdown container="body">
                                                    <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                                                        <i class="fa fa-cog"></i><span class="caret"></span> {{"Actions" | localize}}
                                                    </button>
                                                    <ul class="dropdown-menu" *dropdownMenu>
                                                        <li *ngIf="('Pages.StandardPartsManager.RequirementManagerAudit.Audit' | permission)">
                                                            <a href="javascript:;"  (click)="cancelApplyPackage(record)">拒 绝</a>
                                                        </li>
                                                        <li *ngIf="('Pages.StandardPartsManager.RequirementManagerAudit.Audit' | permission)">
                                                            <a href="javascript:;"  (click)="agreePackage(record)">同 意</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </td>
                                            <td style="width: 50px;text-align: center;">
                                                <span class="ui-column-title">序号</span>
                                                {{rowIndex + 1}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">型号数量改前</span>
                                                {{record.requirementForModelDto.requiredQuantityOfModel}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">型号数量改后</span>
                                                {{record.requirementForModelDto.requiredQuantityOfModel + record.variationValue}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">工艺余量改前</span>
                                                {{record.requirementForModelDto.marginOfCrafts}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">工艺余量改后</span>
                                                {{record.requirementForModelDto.marginOfCrafts + record.changedOfCraft}}
                                            </td>
                                            <td style="width: 150px;text-align: center;">
                                                <span class="ui-column-title">更改原因</span>
                                                {{record.reason}}
                                            </td>
                                            <td style="width: 80px;text-align: center;">
                                                <span class="ui-column-title">状态</span>
                                                <span class="span_state background_gray" *ngIf="record.state==0">
                                                    {{getRequirementChangeHistoryStateString(record.state)}}
                                                </span>
                                                <span class="span_state background_orange" *ngIf="record.state==1">
                                                    {{getRequirementChangeHistoryStateString(record.state)}}
                                                </span>
                                                <span class="span_state background_green" *ngIf="record.state==2">
                                                    {{getRequirementChangeHistoryStateString(record.state)}}
                                                </span>
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">创建人</span>
                                                {{record.changer}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">创建时间</span>
                                                {{record.creationTime | date:'yyyy-MM-dd HH:mm:ss'}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">车间</span>
                                                {{record.requirementForModelDto.usableRange.unitOfUsing}}
                                            </td>
                                            <td style="width: 80px;text-align: center;">
                                                <span class="ui-column-title">型号</span>
                                                {{record.requirementForModelDto.usableRange.belongToModel}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">发次</span>
                                                {{record.requirementForModelDto.usableRange.batch}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">部段</span>
                                                {{record.requirementForModelDto.usableRange.belongToComponent}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">编码</span>
                                                {{record.requirementForModelDto.serialNumber}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">名称</span>
                                                {{record.requirementForModelDto.features.displayName}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">标准</span>
                                                {{record.requirementForModelDto.features.standardNumber}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">规格</span>
                                                {{record.requirementForModelDto.features.specification}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">材料</span>
                                                {{record.requirementForModelDto.features.materials}}
                                            </td>
                                            <td style="width: 100px;text-align: center;">
                                                <span class="ui-column-title">需求时间</span>
                                                {{record.requirementForModelDto.requiredTimeOfModel | date:'yyyy-MM-dd'}}
                                            </td>
                                        </tr>
                                    </ng-template>
                                </p-table>
                                <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                    {{'NoData' | localize}}
                                </div>
                                <div class="primeng-paging-container">
                                    <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage"
                                                    #paginator
                                                    (onPageChange)="getRequirementPackages($event)"
                                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
        
                                    </p-paginator>
                                    <span class="total-records-count">
                                        {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                                    </span>
                                </div>
                            </div>
                        </div>
                    </tab>
                    <!--<tab *ngFor="let tab of tabs"  [heading]="tab.name"  [active]="tab.active" [active]="tab.active"  (deselect)="tab.active = false">
                            <requirementTabComponent #requirementTabComponent  (modalSave)="getRequirementPackages()" [requirementPackage]="tab.record" ></requirementTabComponent>
                    </tab>-->
                </tabset>
            </div>
        </div>
    </div>
    <!--<createOrEditRequirementPackageModal #createOrEditRequirementPackageModal (modalSave)="getRequirementPackages()"></createOrEditRequirementPackageModal>-->
</div>
